
import Vue from 'vue'
import VueRouter from 'vue-router'
// 配置一级路由
import Login from '@/views/login'
import Register from '@/views/register'
import Detail from '@/views/detail'
import Layout from '@/views/layout'
// 配置二级路由
import Like from '@/views/like'
import Article from '@/views/article'
import Collect from '@/views/collect'
import User from '@/views/user'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/login',
      component: Login
    },
    {
      path: '/register',
      component: Register
    },
    {
      path: '/detail',
      component: Detail
    },
    {
      path: '/',
      component: Layout,
      children: [
        {
          path: '/article',
          component: Article
        },
        {
          path: '/like',
          component: Like
        },
        {
          path: '/collect',
          component: Collect
        },
        {
          path: '/user',
          component: User
        }
      ]
    }
  ]
})

export default router
